

import java.awt.*;
import java.awt.event.*;

//import javax.sound.sampled.Port;
import javax.swing.*;
import javax.swing.event.*;

import java.io.*;
import java.net.*;
//import java.net.UnknownHostException;
import java.sql.*;
//import java.rmi.*;
//import java.rmi.server.*;

public class Node_design extends JFrame implements ActionListener {
	public JTabbedPane jTabbedPane1;
	public JPanel contentPane;
	public JTextField jTextField2;
	public JLabel jLabel1, jLabel2, jLabel3;
	public JTextArea jTextArea1;
	public JScrollPane jScrollPane2;
	public JTextArea jTextArea2;
	public JScrollPane jScrollPane3;
	public JButton jButton1;
	public JButton jButton2;
	public JButton jButton3;
	public JButton jButton4;
	public JButton jButton5;
	public JButton jButton6;
	public JPanel jPanel1;
	//public JComboBox<String> jComboBox1;
	public JPanel jPanel2;
	public int i, m, n, k = 0, length1, value, cond = 0;
	long time, d;
	String pac[];
	String s;
	String message = new String();
	Socket client1;
	Socket S1;
	ServerSocket server1;
	private String name;

	public Node_design() {
	}

	public Node_design(String name) {
		this.name = name;
		initializeComponent();
		this.setVisible(true);
		this.setBackground(new Color(156, 0, 51));
	}

	public void initializeComponent() {
		jTabbedPane1 = new JTabbedPane();
		contentPane = (JPanel) this.getContentPane();
		jTextField2 = new JTextField();
		jTextArea1 = new JTextArea();
		jScrollPane2 = new JScrollPane();
		jTextArea2 = new JTextArea();
		jScrollPane3 = new JScrollPane();
		jTextArea1.setFont(new Font("Arial", Font.BOLD, 12));
		jTextArea2.setFont(new Font("Arial", Font.BOLD, 12));
		jButton1 = new JButton();
		jButton1.setFont(new Font("Arial", Font.BOLD, 12));
		jButton1.setBackground(new java.awt.Color(100, 204, 255));
		jButton2 = new JButton();
		jButton2.setFont(new Font("Arial", Font.BOLD, 12));
		jButton2.setBackground(new java.awt.Color(100, 204, 255));
		jButton3 = new JButton();
		jButton3.setFont(new Font("Arial", Font.BOLD, 12));
		jButton3.setBackground(new java.awt.Color(100, 204, 255));
		jButton4 = new JButton();
		jButton4.setFont(new Font("Arial", Font.BOLD, 12));
		jButton4.setBackground(new java.awt.Color(100, 204, 255));
		jButton5 = new JButton();
		jButton5.setFont(new Font("Arial", Font.BOLD, 12));
		jButton5.setBackground(new java.awt.Color(100, 204, 255));
		jButton6 = new JButton();
		jButton6.setFont(new Font("Arial", Font.BOLD, 12));
		jButton6.setBackground(new java.awt.Color(100, 204, 255));
		jPanel1 = new JPanel();
	//	jComboBox1 = new JComboBox();
		//jComboBox1.addActionListener(this);
		//jComboBox1.addItem("Select");
		// jComboBox1.addItem("Node2");
		// jComboBox1.addItem("Node3");
		// jComboBox1.addItem("Node4");
		// jComboBox1.addItem("Node5");
		jLabel2 = new JLabel();
		jLabel2.setFont(new java.awt.Font("Arial", 1, 20));
		jLabel2.setForeground(new java.awt.Color(0, 0, 0));
		jLabel2.setText("SEDUM");
		add(jLabel2);
		jLabel2.setBounds(200, 10, 500, 30);
		jLabel3 = new JLabel();
		jLabel3.setFont(new java.awt.Font("Arial", 1, 20));
		jLabel3.setForeground(new java.awt.Color(200, 0, 100));
		jLabel3.setText(name);
		add(jLabel3);
		jLabel3.setBounds(350, 40, 500, 30);
		jLabel1 = new JLabel();
		jLabel1.setFont(new Font("Arial", Font.BOLD, 12));
		jPanel2 = new JPanel();
		jTabbedPane1.addTab("   Node1   ", jPanel1);
		jTabbedPane1.setFont(new Font("Arial", Font.BOLD, 13));
		jTabbedPane1.addTab("Received Message", jPanel2);
		jTabbedPane1.setFont(new Font("Arial", Font.BOLD, 13));
		JLabel imageLabel2 = new JLabel();
		ImageIcon ii1 = new ImageIcon(this.getClass().getResource("view.JPG"));
		imageLabel2.setIcon(ii1);
		imageLabel2.setBounds(470, 200, 225, 225);
		imageLabel2.setBackground(new Color(193, 222, 216));
		getContentPane().add(imageLabel2);
		jTabbedPane1.addChangeListener(new ChangeListener() {
		public void stateChanged(ChangeEvent e) {
		jTabbedPane1_stateChanged(e);
			}

		});
		jLabel1.setText("File Path:");
		jLabel1.setForeground(new java.awt.Color(153, 0, 100));
		contentPane.setLayout(null);
		addComponent(contentPane, jTabbedPane1, 55, 49, 673, 503);
		jTextField2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				jTextField2_actionPerformed(e);
			}
		});
		jTextArea1.setText("");
		jScrollPane2.setViewportView(jTextArea1);
		jScrollPane3.setViewportView(jTextArea2);
		jButton1.setText("Browse");
		jButton1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				jButton1_actionPerformed(e);
			}
		});
		jButton2.setText("Utility ");
		jButton2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				try {
					jButton2_actionPerformed(e);
				} catch (SQLException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}

			

		});
		jButton3.setText("Exit");
		jButton3.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				try {
					jButton3_actionPerformed(e);
				} catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}

		});
		jButton5.setText("SEND");
		jButton5.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				jButton5_actionPerformed(e);
			}

		});
		jButton6.setText("CLEAR");
		jButton6.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				jButton6_actionPerformed(e);
			}
		});
		jButton4.setText("Exit");
		jButton4.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				jButton4_actionPerformed(e);
			}

		});
		jPanel1.setLayout(null);
		addComponent(jPanel1, jTextField2, 19, 144, 223, 22);
		addComponent(jPanel1, jScrollPane2, 21, 195, 320, 193);
		addComponent(jPanel1, jButton1, 266, 140, 78, 28);
		addComponent(jPanel1, jButton2, 67, 400, 71, 28);
		//addComponent(jPanel1, jComboBox1, 140, 52, 100, 22);
		addComponent(jPanel1, jLabel1, 22, 52, 112, 18);
		addComponent(jPanel1, jButton5, 167, 400, 71, 28);
		addComponent(jPanel1, jButton6, 267, 400, 72, 28);
		addComponent(jPanel1, jButton3, 377, 400, 71, 28);

		jPanel2.setLayout(null);

		addComponent(jPanel2, jScrollPane3, 30, 50, 343, 295);
		addComponent(jPanel2, jButton4, 150, 360, 83, 28);

		this.setTitle("SEDUM ");
		jPanel2.setBackground(new Color(165, 145, 231));
		jPanel1.setBackground(new Color(165, 145, 231));
		contentPane.setBackground(new Color(220, 250, 220));
		this.setLocation(new Point(0, 0));
		this.setSize(new Dimension(800, 634));

		JLabel imageLabel1 = new JLabel();
		ImageIcon v1 = new ImageIcon(this.getClass().getResource("band.JPG"));
		imageLabel1.setIcon(v1);

		imageLabel1.setBounds(0, 0, 1600, 1200);
		getContentPane().add(imageLabel1);

	}

	public void addComponent(Container container, Component c, int x, int y,
			int width, int height) {
		c.setBounds(x, y, width, height);
		container.add(c);
	}

	public void jComboBox1_actionPerformed(ActionEvent e) {
		System.out
				.println("\njComboBox1_actionPerformed(ActionEvent e) called.");
	//	Object o = jComboBox1.getSelectedItem();
	//	System.out.println(">>" + ((o == null) ? "null" : o.toString())
		//		+ " is selected.");
	}

	public void jTabbedPane1_stateChanged(ChangeEvent e) {
		System.out
				.println("\njTabbedPane1_stateChanged(ChangeEvent e) called.");

	}

	public void jTextField2_actionPerformed(ActionEvent e) {
		System.out
				.println("\njTextField2_actionPerformed(ActionEvent e) called.");

	}

	public void jButton1_actionPerformed(ActionEvent e) {

	}
	public void jButton2_actionPerformed(ActionEvent e) throws SQLException 
	{
		// TODO Auto-generated method stub
		
	}

	public void actionPerformed(ActionEvent e) {

		String valu = "";
		//String check = "" + jComboBox1.getSelectedItem();

		if ((e.getSource()) == jButton2) {

		}
	}

	public void jButton3_actionPerformed(ActionEvent e) throws IOException {

		this.dispose();

	}

	public void jButton4_actionPerformed(ActionEvent e) {
		this.dispose();
	}

	public void jButton6_actionPerformed(ActionEvent e) {
		jTextArea1.setText("");
	}

	public void jButton5_actionPerformed(ActionEvent e) {
		System.out.println("send button is called");

	}

	// ============================= Testing ================================//
	// = =//
	// = The following main method is just for testing this class you built.=//
	// = After testing,you may simply delete it. =//
	// ======================================================================//
}